/*
* Copyright 2016 YONYOU Corporation Ltd. All Rights Reserved.
*
* This software is published under the terms of the YONYOU Software
* License version 1.0, a copy of which has been included with this
* distribution in the LICENSE.txt file.
*
* @Project         marketing

* @Package         com.yonyou.marketing.message.push.entrance

* @Author          LuZhen

* @FileName        MessageProtocolContent

* @Date            16/11/9

----------------------------------------------------------------------------------
*     Date          Who             Version         Comments
* 1. 16/11/9        LuZhen          1.0             Create Source
*
----------------------------------------------------------------------------------
*/
package org.marketing.common.entity.pushmessage;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;

/**
 * 用于后端推送
 */
public class MessageProtocolNotificationContent {

    /**
     * 通知提醒内容
     */
    @NotNull
    private String content;

    /**
     * 附加推送参数可选
     * 比如key1=value1,app可以自解析
     */
    private Map<String,String> extraParaMap= new HashMap<>();

    /**
     * 构造函数，填充通知基本内容
     * @param content       提醒内容
     * @param extraParaMap  附加参数
     */
    public MessageProtocolNotificationContent(@NotNull String content, Map<String, String> extraParaMap) {
        super();
        this.content = content;
        this.extraParaMap = extraParaMap;
    }

    /**
     * 反序列化使用
     */
    public MessageProtocolNotificationContent() {
        super();
    }

    /**
     * 是否启用通知扩展 ios10+
     * IOS专用
     * 默认不启用
     */
    private Boolean isIosMultableContent = false;

    /**
     * 是否允许推送唤醒 ios7+
     * IOS专用
     * 默认不启用
     */
    private Boolean isIosContentAvailable = false;

    /**
     * 左上角数字消息
     * IOS专用
     * 默认为+1
     */
    private Integer iosBadge = 0;

    /**
     * 提醒对应声音
     * IOS专用
     * 默认无
     */
    private String iosSound;

    public String getIosCategory() {
        return iosCategory;
    }

    /**
     * Category ios8+
     * IOS专用
     * 默认无
     */
    private String iosCategory;


    /**
     * 设置IOS的后台推送属性
     * @param iosBadge                  角标
     * @param isIosContentAvailable     是否允许推送唤醒
     * @param iosSound                  声音
     * @param isIosMultableContent      是否启用通知扩展
     */
    public void setIOSProperties(Boolean isIosMultableContent,Boolean isIosContentAvailable,Integer iosBadge,String iosSound,String iosCategory){
        this.iosBadge=iosBadge;
        this.iosSound=iosSound;
        this.isIosContentAvailable=isIosContentAvailable;
        this.iosCategory=iosCategory;
        this.isIosMultableContent=isIosMultableContent;
    }


    /**
     * 通知标题
     * 安卓专用
     * 默认为空
     */
    private String androidTitle;

    /**
     * 通知提醒样式
     * 安卓专用
     * 默认为空
     */
    private Integer androidStyleId =0 ;

    /**
     * 设置安卓的后台推送属性
     * @param androidStyleId    通知提醒样式
     * @param androidTitle      通知标题
     */
    public void setAndriodProperties(String androidTitle,Integer androidStyleId){
        this.androidStyleId =androidStyleId;
        this.androidTitle =androidTitle;
    }


    public String getContent() {
        return content;
    }

    public Map<String, String> getExtraParaMap() {
        return extraParaMap;
    }

    public Boolean getIosMultableContent() {
        return isIosMultableContent;
    }

    public Boolean getIosContentAvailable() {
        return isIosContentAvailable;
    }

    public Integer getIosBadge() {
        return iosBadge;
    }

    public String getIosSound() {
        return iosSound;
    }

    public String getAndroidTitle() {
        return androidTitle;
    }

    public Integer getAndroidStyleId() {
        return androidStyleId;
    }
}
